package com.example.mobile2021606129ly0330;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity_mima extends AppCompatActivity {


    private EditText editTextRes;
    private Button butRes;
    private TextView textVRes;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_mima);
        initView();
        butRes.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String a = editTextRes.getText().toString();
                char c1 = 'C';
                char c2 = 'h';
                char c3 = 'i';
                char c4 = 'n';
                char c5 = 'a';
                if (a.equals("China")) {
                    c1 += 4;
                    c2 += 4;
                    c3 += 4;
                    c4 += 4;
                    c5 += 4;
                    char[] arr = {c1, c2, c3, c4, c5};
                    textVRes.setText(String.valueOf(arr));
                } else if (a.length() == 0) {
                    Toast.makeText(MainActivity_mima.this, "请输入字母", Toast.LENGTH_SHORT).show();
                }

            }
        });
    }



    private void initView() {
        editTextRes = (EditText) findViewById(R.id.editText_res);
        butRes = (Button) findViewById(R.id.but_res);
        textVRes = (TextView) findViewById(R.id.textV_res);
    }
}